import api from '../../api';
import { message } from 'antd';

export default {
  namespace: 'historyPriceM',
  state: {},
  effects: {
    // 获取历史定价结果列表
    *getTableDate({ payload, callback }, { call, put }) {
      const response = yield call(api.nonstandardValueReview.getTableData, payload);
      if (response && response.code == 0) {
        callback('success', response.data.dataSource);
      } else {
        callback();
        message.error(response?.msg || '获取历史定价结果列表失败！');
      }
    },
    // 批量复核
    *groupConfirm({ payload, callback }, { call, put }) {
      const res = yield call(api.nonstandardValueReview.groupConfirm, payload);
      if (res && res.code == 0) {
        callback('success');
        message.success('批量复核成功!');
      } else {
        callback('fail');
        message.error(response?.msg || '批量复核失败！');
      }
    },
  },

  reducers: {
    setState(state, { payload }) {
      return {
        ...state,
        ...payload,
      };
    },
  },
};
